<template>
	<view class="detailsPage paper case customTitleBar surnameOrigin" :style="{borderTopWidth:statusBarHeight}">
		<view class="custom-status-bar" :style="{backgroundColor: customTitleBarBg,height:statusBarHeight}"></view>
		<view class="custom-nav-bar tabs-bar" :style="{top:statusBarHeight,backgroundColor: customTitleBarBg,}">
			<text class="tabs-item" @click="toHundredFamilySurnames">百家姓</text>
			<text class="tabs-item" @click="toPaper">论文</text>
			<text class="tabs-item selected" @click="toCase">病例</text>
			<text class="tabs-item" @click="toSurnameOrigin">姓氏来源</text>
		</view>
		<view class="search-bar">
			<view class="search-form">
				<input type="text" placeholder="搜索关键字查询" v-model="searchInput" confirm-type="search" @confirm="dofing">
				<view class="btn-clear" @click.stop="clearInput" v-show="searchInput !=''">清除</view>
			</view>
		</view>
		<view class="container-wrap">
			<view class="container case-list">
				<view class="case-item" v-for="(item, index) in articleList">
					<view class="sn">{{index+1}}</view>
					<view class="content">
						<view class="title">{{item.articleTitle}}</view>
						<view class="body"><u-parse :content="item.articleContent"></u-parse></view>
					</view>
				</view>
			</view>
			<!-- <view class="container">
			<view class="list" >
				<view class="list-item" v-for="(item, index) in articleList" :key="index">
					<view class="surname">{{index+1}}</view>
					<view class="content">
						<view class="title">{{item.articleTitle}}<view class="rate"></view></view>
						<view class="body"><u-parse :content="item.articleContent"></u-parse></view>
					</view>
				</view>
			</view>
			</view> -->
		</view>
		<!-- 底部导航s -->
		<view class="menu-bar">
			<view class="menu-bar-item" @click="toHome"><view class="icon icon-home"></view><text>首页</text></view>
			<view class="menu-bar-item" @click="toPersonalCenter"><view class="icon icon-me"></view><text>我的</text></view>
		</view>
		<!-- 底部导航s -->
	</view>
</template>

<script>
		import { getArticleList} from '@/common/api.js';
	var statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px'
	export default {
		data() {
			return {
				customTitleBarBg: 'rgba(250,250,250,1)',
				statusBarHeight: statusBarHeight,
				searchInput: '',
				articleList:[]
			}
		},onShow() {
			this.getArticleList();
		},
		methods: {
			getArticleList(){
				// get请求 1论文 2案例
				getArticleList({params:{ 'articleType':2,'searchInput':this.searchInput}}).then(data => {
					console.log(data)
					this.articleList=data;
				
				}).catch(() =>{
					
				})
			},dofing(){
				this.getArticleList();
			},
			clearInput() {
				this.searchInput = '';
			},
			toDetails() {
				uni.navigateTo({
					url: '../details/details',
				});
			},
			toHundredFamilySurnames() {
				uni.redirectTo({
					url: '../hundredFamilySurnames/hundredFamilySurnames',
				});
			},
			toCase() {
				uni.redirectTo({
					url: '../case/case',
				});
			},
			toPaper() {
				uni.redirectTo({
					url: '../paper/paper',
				});
			},
			toSurnameOrigin() {
				uni.redirectTo({
					url: '../surnameOrigin/surnameOrigin',
				});
			},
			toHome() {
				uni.redirectTo({
					url: '../index/index',
				});
			},
			toPersonalCenter() {
				uni.redirectTo({
					url: '../personalCenter/personalCenter',
				});
			},
			
		}
	}
</script>

<style>
	page{background-color: #fff;}
</style>